import Vue from "vue";
import VueI18n from "vue-i18n";
import ja from "@/locale/ja.json";
import en from "@/locale/en.json";
import zh from "@/locale/zh.json";
import kr from "@/locale/kr.json";

Vue.use(VueI18n);

const messages = {
  ja: ja,
  en: en,
  zh: zh,
  kr: kr,
};

const i18n = new VueI18n({
  locale: window.localStorage.getItem('locale') || 'zh',
  fallbackLocale: window.localStorage.getItem('locale') || 'zh',
  messages,
});

export default i18n;